<?php $this->load->view('admin/public/head.html', array('css' => array(
'/assets/admin/css/admin/common.css',
))); ?>

<!-- Content Wrapper. Contains page content -->
<div class="content-wrapper" ng-controller="admin-money-purchaser-apply">
    <!-- Content Header (Page header) -->
    <section class="content-header">
        <h1>
            账务管理
            <small>用户账务管理模块</small>
        </h1>
        <ol class="breadcrumb">
            <li><a href="#"><i class="fa fa-dashboard"></i> 后台首页</a></li>
            <li class="active">供应商对账</li>
        </ol>
    </section>

    <!-- Main content -->
    <section class="content p">

        <div class="row" style="margin-top: 15px; margin-bottom: 20px;">

            <div class="col-md-12" style="margin-bottom: 20px;">
                <div class="tips" style="padding: 20px 15px;border: 1px solid #faebcc; background: #fcf8e3; color: #8a6d3b;">
                    <strong>重要提示： </strong> 当月账单只允许查看，不可申请对账
                </div>
            </div>

            <div class="col-md-12">
                <form class="form-inline">
                    <div class="form-group">
                        <label>请选择订单完成时间月份：</label>
                        <div class="btn-group">
                            <button type="button" class="btn btn-default btn-flat" ng-bind="selectedYear + '年'"></button>
                            <button type="button" class="btn btn-default btn-flat dropdown-toggle" data-toggle="dropdown">
                                <span class="caret"></span>
                                <span class="sr-only">Toggle Dropdown</span>
                            </button>
                            <ul class="dropdown-menu" role="menu">
                                <li ng-repeat="(key, year) in years"><a ng-click="selectYear(key)" ng-bind="year"></a></li>
                            </ul>
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="btn-group">
                            <button type="button" class="btn btn-default btn-flat" ng-bind="selectedMonth + '月'"></button>
                            <button type="button" class="btn btn-default btn-flat dropdown-toggle" data-toggle="dropdown">
                                <span class="caret"></span>
                                <span class="sr-only">Toggle Dropdown</span>
                            </button>
                            <ul class="dropdown-menu" role="menu">
                                <li ng-repeat="(key, month) in monthes"><a ng-click="selectMonth(key)" ng-bind="month + '月'"></a></li>
                            </ul>
                        </div>
                    </div>
                    <button type="submit" class="btn btn-default" ng-click="checkOrder()">立即查看</button>
                </form>
            </div>
        </div>

        <div class="row" ng-show="!has">
            <div class="col-md-12">
                <p class="help-block text-center">还没有选择区间完成订单~</p>
            </div>
        </div>

        <div class="row" ng-show="has">
            <!-- 列表 -->
            <div class="col-md-12">
                <div class="box" style="padding-bottom: 30px;">
                    <h4 class="p-desc" ng-bind="'时间区间：' + selectedYear + '年' + selectedMonth + '月'"></h4>
                    <div class="p-banner">
                        <ul>
                            <li class="r-border">
                                <strong ng-bind="result.count"></strong>
                                <p>订单量</p>
                            </li>
                            <li class="r-border">
                                <strong style="color: red;" ng-bind="result.total"></strong>
                                <p>交易总额</p>
                            </li>
                            <li class="r-border">
                                <strong style="color: #00a65a;" ng-bind="'-' + result.delivery"></strong>
                                <p>货到付款</p>
                            </li>
                            <li class="r-border">
                                <strong style="color: #00a65a;" ng-bind="'-' + result.refund"></strong>
                                <p>退款</p>
                            </li>
                            <li>
                                <strong class="text-warning" ng-bind="result.amount"></strong>
                                <p>商家应得</p>
                            </li>
                            <li class="p-btn">
                                <button class="btn btn-default" ng-click="result.count > 0 && showApplyBtn && alertModal()" ng-class="{'active': showApplyBtn && result.count > 0}">申请对账</button>
                            </li>
                        </ul>
                    </div>

                    <div class="pull-right" style="height: 30px; line-height: 30px;"><a href="/bill/purchaser/export?baseId=<?=$baseId?>&year={{selectedYear}}&month={{selectedMonth}}" style="margin-right: 25px; color: #00a65a; text-decoration: underline;">下载数据</a></div>
                    <table class="table">
                        <tr>
                            <th class="text-center">#</th>
                            <th class="text-center">订单号</th>
                            <th class="text-center">结算时间</th>
                            <th class="text-center">交易总金额</th>
                            <th class="text-center">商品金额</th>
                            <th class="text-center">物流费用</th>
                            <th class="text-center">用户类型</th>
                            <th class="text-center">支付类型</th>
                            <th class="text-center">支付方式</th>
                        </tr>
                        <tr ng-repeat="l in result.lists">
                            <td class="text-center" ng-bind="l.id"></td>
                            <td class="text-center">
                                <a href="###" ng-bind="l.sn"></a>
                            </td>
                            <td class="text-center" ng-bind="l.compTime"></td>
                            <td class="text-center" ng-bind="l.totalPrice"></td>
                            <td class="text-center" ng-bind="l.goodsPrice"></td>
                            <td class="text-center" ng-bind="l.expressPrice"></td>
                            <td class="text-center" ng-bind="l.priceType == 1 ? '采购商' : '普通用户'"></td>
                            <td class="text-center" ng-bind="l.payMode == 'online' ? '在线支付' : '货到付款'"></td>
                            <td class="text-center" ng-bind="l.payWay == 1 ? '支付宝' : '微信'"></td>
                        </tr>
                        <tr ng-if="result.lists && result.lists.length == 0">
                            <td colspan="9" class="text-center" style="color: #CCCCCC;">暂无数据</td>
                        </tr>
                    </table>
                </div>
            </div>

        </div>
    </section>
    <!-- /.content -->
</div>

<!-- /.content-wrapper -->
<?php $this->load->view('admin/public/foot.html', array(
'js' => array(
'/assets/admin/js/money/purchaser/apply.js',
)
)); ?>
